// Author: Ivan Chau
package uk.ac.cam.kcic2.math;

public class Vector3DHomo {
		
	public final double x, y, z, w;
	
	public Vector3DHomo(Vector3D vector){
		x = vector.x;
		y = vector.y;
		z = vector.z;
		w = 1;
	}
	
	public Vector3DHomo(double[] values){
		assert values.length == Params.MATRIX_DIM;
		assert values[Params.W] > Params.EPILSON;
		
		x = values[Params.X];
		y = values[Params.Y];
		z = values[Params.Z];
		w = values[Params.W]; 
	
	}
	
	public double get(int index){
		assert index >= Params.X && index <= Params.W;
		
		switch(index){
		case Params.X: return x;
		case Params.Y: return y;
		case Params.Z: return z;
		case Params.W: return w;
		default: throw new IndexOutOfBoundsException();
		}
	}
}
